<template>
	<view class="content">
		<view class="my-v type-v">
			<view class="title">类型</view>
			
			<uni-segmented-control :current="curNow" :values="list" @clickItem="sectionChange" styleType="button" activeColor="#e98f36"></uni-segmented-control>
			       <!-- <view class="content">
			            <view v-show="current === 0">
			                选项卡1的内容
			            </view>
			            <view v-show="current === 1">
			                选项卡2的内容
			            </view>
			            <view v-show="current === 2">
			                选项卡3的内容
			            </view>
			        </view> -->
			
			<!-- <u-subsection :list="list" :mode="mode" :current="curNow" @change="sectionChange"></u-subsection> -->
			<view class="info">已选: {{list[curNow]}}</view>
		</view>
		
		<view class="my-v time-v">
			<view class="title">时间</view>
			<uni-datetime-picker
							return-type="string"
						   start="2000-01-01"
						   placeholder="请选择时间"
			               type="date"
			               v-model="datetimesingle"
			               @change="changeLog"
			           />
			<view class="info"><text v-if="timeTxt.length>0"> 已选: {{timeTxt}}</text></view>
		</view>
		
		<view class="query-btn">
			<button @click="doQuery" type="primary">查 询</button>
		</view>
		
		
	</view>
</template>

<script>
	export default{
		data(){
			return{
				segmentedColor:"#e98f36",
				datetimesingle:'',
				queryBtnShow:true,
				 show:false,
				 modeDate: 'single',
				 list: ['黄历', '吉时', '吉神凶煞'],
				 curNow: 0,
				 mode:"subsection",
				 timeTxt:''
			}
		},methods:{
			changeLog(e){
				this.timeTxt = e;
			},
			sectionChange(e) {
				this.curNow = e.currentIndex;
			},
			doQuery(){
				if(this.timeTxt.length === 0){
					uni.showToast({
						title:'请选择时间哦',
						icon:'error'
					})
					return;
				}
				
				if(this.curNow === 0){
					uni.navigateTo({
						url:'hl?type=2&ymd='+this.timeTxt
					})
				}else if(this.curNow === 1){
					uni.navigateTo({
						url:'js?type=3&ymd='+this.timeTxt
					})
				}else if(this.curNow === 2){
					uni.navigateTo({
						url:'jsxs?type=4&ymd='+this.timeTxt
					})
				}
			}
		}
	}
</script>

<style lang="scss">
	.my-v{
		background-color: #fff;
		padding: 20rpx;
		margin: 30rpx;
		border-radius: 20rpx;
		.title{
			margin-bottom: 20rpx;
			text-align: center;
		}
	}
	.info{
		margin-top: 30rpx;
		text-align: center;
		font-size: 30rpx;
		color: #DD524D;
	}
	.query-btn{
		position: fixed;
		bottom: 0;
		width: calc(100% - 60rpx);
		margin: 30rpx;
	}
</style>

